unit uPesquisaVendedor;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uPesquisaPadrao, DB, IBODataset, ComCtrls, Grids, DBGrids,
  RXDBCtrl, StdCtrls, RXCtrls, ExtCtrls;

type
  TfPesquisaVendedor = class(TfPesquisaPadrao)
    queryCODIGO: TIntegerField;
    queryNOME: TStringField;
    queryCPF_CNPJ: TStringField;
    queryRG_IE: TStringField;
    queryENDERECO: TStringField;
    queryNUMERO: TStringField;
    queryBAIRRO: TStringField;
    queryCOMPLEMENTO: TStringField;
    queryCEP: TStringField;
    queryTELEFONE: TStringField;
    queryCELULAR: TStringField;
    querySITUACAO: TStringField;
    queryCIDADE_FK: TSmallintField;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fPesquisaVendedor: TfPesquisaVendedor;

implementation

{$R *.dfm}

procedure TfPesquisaVendedor.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  inherited;
  if key = #13 then
  begin
    query.close;
    query.SQL.Clear;
    query.SQL.Add('select pessoa.* from vendedor');
    query.SQL.Add('inner join pessoa on pessoa.codigo = vendedor.codigo');
    query.SQL.Add('where pessoa.nome like '''+Edit1.Text+'%''');
    query.SQL.Add('and pessoa.situacao = ''A'' ');
    query.SQL.Add('order by pessoa.nome');
    query.Open;
  end;
end;

end.
